package fun.symtable.tablemodel;

import fun.symtable.VariableEntry;

public class VariableTableModel extends SymbolTableModel<VariableEntry> {
    private static String[] columnNames = { "Scope", "Name", "Value" };

    public String getColumnName(int column) {
	return columnNames[column];
    }

    public int getColumnCount() {
	return columnNames.length;
    }

    public Object getValueAt(int row, int column) {
	if (0 == column)
	    return this.scope.get(row);
	VariableEntry id = this.data.get(row);
	if (1 == column)
	    return id.getName();
	else if (2 == column)
	    return id.getValue();
	return "(error)";
    }

}
